\(\int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx\) [234]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 28 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {a \sec (c+d x)}{d}+\frac {b \sec ^2(c+d x)}{2 d} \]

[Out]

a*sec(d*x+c)/d+1/2*b*sec(d*x+c)^2/d

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {4462, 12, 2686, 30, 8} \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {a \sec (c+d x)}{d}+\frac {b \sec ^2(c+d x)}{2 d} \]

[In]

Int[Sec[c + d*x]^2*(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

(a*Sec[c + d*x])/d + (b*Sec[c + d*x]^2)/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 4462

Int[(u_)*((v_) + (d_.)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^(n_.)), x_Symbol] :> With[{e = FreeFactors[Cos[c*(a +
b*x)], x]}, Int[ActivateTrig[u*v], x] + Dist[d, Int[ActivateTrig[u]*Sin[c*(a + b*x)]^n, x], x] /; FunctionOfQ[
Cos[c*(a + b*x)]/e, u, x]] /; FreeQ[{a, b, c, d}, x] &&  !FreeQ[v, x] && IntegerQ[(n - 1)/2] && NonsumQ[u] &&
(EqQ[F, Sin] || EqQ[F, sin])

Rubi steps \begin{align*} \text {integral}& = a \int \sec (c+d x) \tan (c+d x) \, dx+\int b \sec ^2(c+d x) \tan (c+d x) \, dx \\ & = b \int \sec ^2(c+d x) \tan (c+d x) \, dx+\frac {a \text {Subst}(\int 1 \, dx,x,\sec (c+d x))}{d} \\ & = \frac {a \sec (c+d x)}{d}+\frac {b \text {Subst}(\int x \, dx,x,\sec (c+d x))}{d} \\ & = \frac {a \sec (c+d x)}{d}+\frac {b \sec ^2(c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.00 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {a \sec (c+d x)}{d}+\frac {b \sec ^2(c+d x)}{2 d} \]

[In]

Integrate[Sec[c + d*x]^2*(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

(a*Sec[c + d*x])/d + (b*Sec[c + d*x]^2)/(2*d)

Maple [A] (verified)

Time = 0.42 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.89

method result size
derivativedivides \(\frac {\frac {b \sec \left (d x +c \right )^{2}}{2}+\sec \left (d x +c \right ) a}{d}\) \(25\)
default \(\frac {\frac {b \sec \left (d x +c \right )^{2}}{2}+\sec \left (d x +c \right ) a}{d}\) \(25\)
risch \(\frac {2 a \,{\mathrm e}^{3 i \left (d x +c \right )}+2 b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 a \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}\) \(53\)

[In]

int(sec(d*x+c)^2*(sin(d*x+c)*a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/2*b*sec(d*x+c)^2+sec(d*x+c)*a)

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.86 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {2 \, a \cos \left (d x + c\right ) + b}{2 \, d \cos \left (d x + c\right )^{2}} \]

[In]

integrate(sec(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(2*a*cos(d*x + c) + b)/(d*cos(d*x + c)^2)

Sympy [F]

\[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right ) \sec ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(sec(d*x+c)**2*(a*sin(d*x+c)+b*tan(d*x+c)),x)

[Out]

Integral((a*sin(c + d*x) + b*tan(c + d*x))*sec(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.96 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {b \tan \left (d x + c\right )^{2} + \frac {2 \, a}{\cos \left (d x + c\right )}}{2 \, d} \]

[In]

integrate(sec(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(b*tan(d*x + c)^2 + 2*a/cos(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 71 vs. \(2 (26) = 52\).

Time = 0.35 (sec) , antiderivative size = 71, normalized size of antiderivative = 2.54 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {2 \, {\left (a + \frac {a {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1}\right )}}{d {\left (\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1\right )}^{2}} \]

[In]

integrate(sec(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="giac")

[Out]

2*(a + a*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) - b*(cos(d*x + c) - 1)/(cos(d*x + c) + 1))/(d*((cos(d*x + c) -
1)/(cos(d*x + c) + 1) + 1)^2)

Mupad [B] (verification not implemented)

Time = 22.61 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.86 \[ \int \sec ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {\frac {b}{2}+a\,\cos \left (c+d\,x\right )}{d\,{\cos \left (c+d\,x\right )}^2} \]

[In]

int((a*sin(c + d*x) + b*tan(c + d*x))/cos(c + d*x)^2,x)

[Out]

(b/2 + a*cos(c + d*x))/(d*cos(c + d*x)^2)